
package com.ruoyi.celoan.util;

public class TestBaseApiClientBak {
    /*private static final Logger log = LoggerFactory.getLogger(com.ruoyi.celoan.util.TestBaseApiClientBak.class);
    private String appId = "c969235926ef486b94f7a65e7e2e0d9c";
    private String appKey = "hbhd_gdl";
    private String appSecret = "5faa500c1c8e5ed0f40217dd3a6a7269";
    BaseApiClient client = (new BaseApiClientBuilder())
            .serverUrl("http://39.105.97.94:8685/gw/rs/s3")
            .appId("c969235926ef486b94f7a65e7e2e0d9c")
            .appKey("hbhd_gdl")
            .appSecret("5faa500c1c8e5ed0f40217dd3a6a7269")
            .publicKey("04C94320A5F38226438DC8804CA77012B507002A056C1E3484ED3EDBCCD5D8961354F6DE35D3979051E3815C0DA396B2A2939345A2D3FD3FEAF55B15D54E5DFD2E")
            .privateKey("00C53F7CB52D1320622AF326F522557DC77DD932AB57099EFE43F0F0B6E695FA26")
            .build();

    @Test
    public void test_get_public_key() throws Exception {
        String publicKey = this.client.getPublicKey();
        log.info("get public key {}", publicKey);
    }

    @Test
    public void test_change_app_secret() throws Exception {
        String newAppSecret = this.client.changeAppSecret();
        log.info("new secret key is {}", newAppSecret);
    }

    @Test
    public void test_get_token() throws Exception {
        String token = this.client.getToken();
        log.info("get token {}", token);
    }

    @Test
    public void test_get_public_information() throws Exception {
        PublicInformationGetRequest request = new PublicInformationGetRequest(this.name);
        PublicInformationGetResponse response = (PublicInformationGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get public information response {}", response);
    }

    @Test
    public void test_get_basic() throws Exception {
        EnterpriseBasicGetRequest request = new EnterpriseBasicGetRequest(this.name);
        EnterpriseBasicGetResponse response = (EnterpriseBasicGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get basic response {}", response);
        log.info("get basic {}", response.getBasic(this.name));
    }

    private String name = "乐视网信息技术(北京)股份有限公司";

    @Test
    public void test_administrative_license() throws Exception {
        AdministrativeLicenseGetRequest request = new AdministrativeLicenseGetRequest(this.name);
        AdministrativeLicenseGetResponse response = (AdministrativeLicenseGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get administrative license {}", response);
    }

    @Test
    public void test_administrative_sanction() throws Exception {
        AdministrativeSanctionGetRequest request = new AdministrativeSanctionGetRequest(this.name);
        AdministrativeSanctionGetResponse response = (AdministrativeSanctionGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get administrative sanction:{}", response);
    }

    @Test
    public void test_dishonest_punishment() throws Exception {
        DishonestPunishmentGetRequest request = new DishonestPunishmentGetRequest(this.name);
        DishonestPunishmentGetResponse response = (DishonestPunishmentGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get dishonest punishment {}", response);
    }

    @Test
    public void test_credit_incentive() throws Exception {
        CreditIncentiveGetRequest request = new CreditIncentiveGetRequest(this.name);
        CreditIncentiveGetResponse response = (CreditIncentiveGetResponse) this.client.execute((AbstractApiRequest) request);
        log.info("get credit incentive {}", response);
    }

    @Test
    public void test_post_statistics() throws Exception {
        AreaStatistics item1 = AreaStatistics.builder().province("福建省").city("").areaCode("350000").registeredEnterpriseNum(Integer.valueOf(100)).creditEnterpriseNum(Integer.valueOf(50)).loanEnterpriseNum(Integer.valueOf(50)).creditLoanEnterpriseNum(Integer.valueOf(30)).financingNeedsEnterpriseNum(Integer.valueOf(80)).creditAmount(new BigDecimal(500.24D)).creditNum(Integer.valueOf(50)).loanAmount(new BigDecimal(500.23D)).loanNum(Integer.valueOf(50)).creditLoanAmount(new BigDecimal(300.2D)).creditLoanNum(Integer.valueOf(30)).financingNeedsAmount(new BigDecimal(5000.5D)).financingNeedsNum(Integer.valueOf(1000)).dockingNum(Integer.valueOf(100)).overdueNum(Integer.valueOf(10)).averageLendingRate(new BigDecimal(11.22D)).fullBusinessProcessAveragePeriod(Integer.valueOf(20)).creditAveragePeriod(Integer.valueOf(20)).loanAveragePeriod(Integer.valueOf(20)).creditLoanAveragePeriod(Integer.valueOf(20)).nearlyYearLoanAmount(new BigDecimal(5000)).nearlyYearLoanNum(Integer.valueOf(1000)).nearlyYearLoanEnterpriseNum(Integer.valueOf(1000)).nearlyYearCreditLoanAmount(new BigDecimal(500)).nearlyYearCreditLoanNum(Integer.valueOf(500)).nearlyYearCreditLoanEnterpriseNum(Integer.valueOf(100)).nearlyYearFinancingNeedsAmount(new BigDecimal(2000)).nearlyYearFinancingNeedsNum(Integer.valueOf(1000)).settledInFinancialInstitutionNum(Integer.valueOf(20)).financialProductsNum(Integer.valueOf(100)).externalSystemId("").statisticsBeginTime("2019-10-01 22:00:00").statisticsEndTime("2020-11-11 11:46:13").build();
        StatisticsPostRequest request = new StatisticsPostRequest(Lists.newArrayList((Object[]) new AreaStatistics[]{item1}));
        StatisticsPostResponse response = (StatisticsPostResponse) this.client.execute((AbstractApiRequest) request);
        log.info("post statistics {}", response);
    }

    @Test
    public void test_post_enterprise() throws Exception {
    }

    @Test
    public void test_upload_license() throws Exception {
        FileSystemResource resource = new FileSystemResource(new File("E://190702.pdf"));
        Map<String, Object> param = new HashMap<>();
        InputStream in = resource.getInputStream();
        byte[] bytes = new byte[resource.getInputStream().available()];
        in.read(bytes);
        String hashCode = SM2Utils.summary(bytes);
        log.info("数据摘要：{}", hashCode);
        param.put("file", new File("E://190702.pdf"));
        param.put("enterpriseName", "厦门中小在线信息服务有限公司");
        param.put("uniscId", "91350200761733778F");
        param.put("licenseFileType", "1");
        param.put("caSupplier", "caSupplier");
        param.put("validateUrl", "validateUrl");
        if ("2".equals(param.get("licenseFileType").toString())) ;
        param.put("privilegedTime", "2019-06-07 20:00:30");
        param.put("expirationTime", "2021-12-17 20:00:30");
        param.put("hashCode", hashCode);
    }

    @Test
    public void test_public_resources_trading() throws Exception {
        TranRecordTrading data = TranRecordTrading.builder().enterpriseName("123").year(Integer.valueOf(2020)).type("01").pageIndex(Integer.valueOf(1)).pageSize(Integer.valueOf(50)).licenseId("test_upload_licenses上传接口返回licenseId").build();
        PublicResourcesTradingRequest request = new PublicResourcesTradingRequest(data);
        PublicResourcesTradingResponse response = (PublicResourcesTradingResponse) this.client.execute((AbstractApiRequest) request);
        log.info("公共资源交易返回={}", response);
    }

    @Test
    public void generateSm2Key() {
        SM2 sm2 = SM2.Instance();
        AsymmetricCipherKeyPair key = sm2.ecc_key_pair_generator.generateKeyPair();
        ECPrivateKeyParameters ecPriKey = (ECPrivateKeyParameters) key.getPrivate();
        ECPublicKeyParameters ecPubKey = (ECPublicKeyParameters) key.getPublic();
        BigInteger privateKey = ecPriKey.getD();
        ECPoint publicKey = ecPubKey.getQ();
        log.info("公钥: " + NationalSecretsUtils.byteToHex(publicKey.getEncoded()));
        log.info("私钥: " + NationalSecretsUtils.byteToHex(privateKey.toByteArray()));
    }*/
}
